// import { useEffect, useState } from 'react'
// import { Tabs } from 'antd';
// import './App.css'
// import axios from 'axios'



// const App:React.FC=() =>{

//   const [newlist, setnewlist] = useState([])
//   const xuanRan = async () => {
//     const res = await axios.get('/api/classList')
//     console.log(res)
//     const { data } = res.data
//     setnewlist(data)
//   }
//   useEffect(() => {
//     xuanRan()
//   }, [])
//   const onChange = (key: string) => {
//     console.log(key);
//   };
//   return (
//     <div className='hh'>
//       <Tabs defaultActiveKey="1" onChange={onChange} >
//         {
//           newlist.map((item,index) => (
//               <Tabs.TabPane tab={item.label} key={index}>
//                 {
//                   item.children.map((it, y) => (
//                     <p key={y}>
//                       <span>{ y<3 ? y+1 : ''}</span>
//                       {it.word}
//                     </p>

//                   ))
//                 }
//               </Tabs.TabPane>
//           ))}
//       </Tabs>
//     </div>
//   )
// }

// export default App
import { useEffect, useState } from 'react'

import './App.css'
import axios from 'axios'
import { Tabs } from 'antd'

const App: React.FC = () => {

  const [list, setlist] = useState([])
  const xuanRan = async () => {
    const res = await axios.get('/api/cartList')
    console.log(res)
    const { data } = res.data
    setlist(data)
  }
  useEffect(() => {
    xuanRan()
  }, [])
  const onChange = (key: string) => {
    console.log(key);
  };
  
  return (
    <div className='hh'>
      <Tabs defaultActiveKey="1" onChange={onChange} >
        {
          list.map((item, index) => (
            <Tabs.TabPane tab={item.label} key={ index}>
              {
                item.children.map((it, y) => (
                  <p key={y}>
                    <span>{ y<3 ? y+1 : ''}</span>
                    {it.word}</p>
                 ))
              }
            </Tabs.TabPane>
          ))
        }
      </Tabs>
    </div>
  )
}

export default App

